<?php
namespace Common\Model;

use Think\Model;

class LvModel extends Model
{
    public function get_lv_one($lv_id = '')
    {
        $map['lv_id'] = intval($lv_id);
        $lv = $this->where($map)->find();
        return $lv;
    }

    /**
     * 获取等级设置列表
     *
     * @return array|null|false
     */
    public function get_lv_list()
    {
        $list = $this->order('exp_min ASC')->select();
        return $list;
    }

    /**
     * 获取经验等级
     *
     * @param int $exp
     * @return string 等级字符串(数字)
     */
    public function get_lv_level($exp)
    {
        $exp = intval($exp);
        $lv = $this->field('lv_id')->where($exp . ' between exp_min and exp_max')->find();
        return $lv['lv_id'];
    }

}